﻿@page "/sdk/access/user/c/{PageName?}"

@model WebVella.Erp.Plugins.SDK.Pages.User.CreateModel
@using WebVella.Erp.Web.Utils;
@{
	Layout = "~/Pages/_AppMaster.cshtml";
	ViewData["Title"] = "Create New Application";

}

<wv-page-header color="#dc3545" area-label="Users" title="New User"
				icon-class="fa fa-plus" return-url="@Model.ReturnUrl">
	<wv-page-header-actions>
		<wv-button type="Submit" form="CreateRecord" size="Small" color="Green" icon-class="fa fa-plus go-white" text="Create User"></wv-button>
		<wv-button type="LinkAsButton" size="Small" href="@Model.ReturnUrl" text="Cancel" color="White"></wv-button>
	</wv-page-header-actions>
</wv-page-header>

<wv-validation errors="@Model.Validation.ToErrorList()" message="@Model.Validation.Message"></wv-validation>

<wv-form id="CreateRecord" name="CreateRecord" validation-errors="Model.Validation.ToErrorList()" label-mode="Stacked" mode="Form" autocomplete="false">
	<wv-section class="mt-4">
		<wv-row>
			<wv-column span="6">
				<wv-field-email label-text="Email" value="@Model.Email" name="Email" required="true"></wv-field-email>
				<wv-field-text label-text="Username" value="@Model.UserName" name="UserName" required="true"></wv-field-text>
			</wv-column>
			<wv-column span="6">
				<wv-field-image label-text="Image" value="@Model.Image" name="Image" width="80" height="80"></wv-field-image>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-password label-text="Password" value="@Model.Password" name="Password" required="true"></wv-field-password>
			</wv-column>
			<wv-column span="6">
				<wv-field-multiselect label-text="Assign roles" value="@Model.Roles" name="Roles" options="Model.RoleOptions.ToWvSelectOption()"></wv-field-multiselect>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-text label-text="First Name" value="@Model.FirstName" name="FirstName"></wv-field-text>
			</wv-column>
			<wv-column span="6">
				<wv-field-text label-text="Last Name" value="@Model.LastName" name="LastName"></wv-field-text>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-checkbox label-text="Enabled" value="@Model.Enabled" name="Enabled" text-true="enabled user"></wv-field-checkbox>
			</wv-column>
			<wv-column span="6">
				<wv-field-checkbox label-text="Verified" value="@Model.Verified" name="Verified" text-true="verified email"></wv-field-checkbox>
			</wv-column>
		</wv-row>
	</wv-section>
</wv-form>
